﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Yunzuan.Foundation.Attributes;
using Yunzuan.Foundation.Entities;

namespace CloudDiamonds.Models.DBModels
{
    [Table(TableName = "yz_order", PrimaryKey = "OrderID")]
    public partial class Order : BaseEntity
    {
        public Order()
        { }
        #region Model
         private int _orderid;
		/// <summary>
		///主键ID
		/// </summary>
        [Column(IsAutoIncrement = true)]
		public int OrderID
		{
		get{ return _orderid;}
		set{this.ChangeNotify<int>("OrderID", value, ref _orderid);}
		}
		private string _orderno;
		/// <summary>
		///订单号(规则待定)
		/// </summary>
		public string OrderNo
		{
		get{ return _orderno;}
		set{this.ChangeNotify<string>("OrderNo", value, ref _orderno);}
		}
		private int _goodstypeid;
		/// <summary>
		///商品类别(1裸钻,2统包,3成品,4彩宝,5翡翠,6其他,7素金)
		/// </summary>
		public int GoodsTypeID
		{
		get{ return _goodstypeid;}
		set{this.ChangeNotify<int>("GoodsTypeID", value, ref _goodstypeid);}
		}
		private int _inventoryid;
		/// <summary>
		///商品ID
		/// </summary>
		public int InventoryID
		{
		get{ return _inventoryid;}
		set{this.ChangeNotify<int>("InventoryID", value, ref _inventoryid);}
		}
		private int _inventorycount = 1;
		/// <summary>
		///商品数量
		/// </summary>
		public int InventoryCount
		{
		get{ return _inventorycount;}
		set{this.ChangeNotify<int>("InventoryCount", value, ref _inventorycount);}
		}
		private string _images;
		/// <summary>
		///图片
		/// </summary>
		public string Images
		{
		get{ return _images;}
		set{this.ChangeNotify<string>("Images", value, ref _images);}
		}
		private string _supplier;
		/// <summary>
		///供应商，不用手动指定
		/// </summary>
		public string Supplier
		{
		get{ return _supplier;}
		set{this.ChangeNotify<string>("Supplier", value, ref _supplier);}
		}
		private string _originsn;
		/// <summary>
		///原货号
		/// </summary>
		public string OriginSN
		{
		get{ return _originsn;}
		set{this.ChangeNotify<string>("OriginSN", value, ref _originsn);}
		}
		private int _onshelves = 1;
		/// <summary>
		///是否上架
		/// </summary>
		public int OnShelves
		{
		get{ return _onshelves;}
		set{this.ChangeNotify<int>("OnShelves", value, ref _onshelves);}
		}
		private DateTime? _arrivaltime;
		/// <summary>
		///到货时间
		/// </summary>
		public DateTime? ArrivalTime
		{
            get
            {
                if (_arrivaltime != null && Convert.ToDateTime(_arrivaltime.ToString()).Year > 1970)
                    return _arrivaltime;
                else
                    return null;
            }
		set{this.ChangeNotify<DateTime?>("ArrivalTime", value, ref _arrivaltime);}
		}
		private int? _isfancy;
		/// <summary>
		///是否为彩钻（0或者NULL白钻，1彩钻）
		/// </summary>
		public int? IsFancy
		{
		get{ return _isfancy;}
		set{this.ChangeNotify<int?>("IsFancy", value, ref _isfancy);}
		}
		private string _inventoryattribute;
		/// <summary>
		///商品属性(包含颜色重量切工等信息..)
		/// </summary>
		public string InventoryAttribute
		{
		get{ return _inventoryattribute;}
		set{this.ChangeNotify<string>("InventoryAttribute", value, ref _inventoryattribute);}
		}
		private decimal _rapnet;
		/// <summary>
		///国际报价
		/// </summary>
		public decimal Rapnet
		{
		get{ return _rapnet;}
		set{this.ChangeNotify<decimal>("Rapnet", value, ref _rapnet);}
		}
        private decimal? _purchaseUSD;
		/// <summary>
		///买入的美金价格
		/// </summary>
        public decimal? PurchaseUSD
		{
            get { return _purchaseUSD; }
            set { this.ChangeNotify<decimal?>("PurchaseUSD", value, ref _purchaseUSD); }
		}
		private decimal _purchaseexchangerate;
		/// <summary>
		///采购汇率
		/// </summary>
		public decimal PurchaseExchangerate
		{
		get{ return _purchaseexchangerate;}
		set{this.ChangeNotify<decimal>("PurchaseExchangerate", value, ref _purchaseexchangerate);}
		}
		private decimal? _purchasermb;
		/// <summary>
		///买入的人民币价格
		/// </summary>
		public decimal? PurchaseRMB
		{
		get{ return _purchasermb;}
		set{this.ChangeNotify<decimal?>("PurchaseRMB", value, ref _purchasermb);}
		}
        private decimal? _purchaseReturn;
		/// <summary>
		///买入退点
		/// </summary>
        public decimal? PurchaseReturn
		{
            get { return _purchaseReturn; }
            set { this.ChangeNotify<decimal?>("PurchaseReturn", value, ref _purchaseReturn); }
		}
		private decimal? _confirmusd;
		/// <summary>
		///出售的美金价格
		/// </summary>
		public decimal? ConfirmUSD
		{
		get{ return _confirmusd;}
		set{this.ChangeNotify<decimal?>("ConfirmUSD", value, ref _confirmusd);}
		}
		private decimal? _salesexchangerate;
		/// <summary>
		///销售汇率
		/// </summary>
		public decimal? SalesExchangerate
		{
		get{ return _salesexchangerate;}
		set{this.ChangeNotify<decimal?>("SalesExchangerate", value, ref _salesexchangerate);}
		}
        private decimal? _confirmRMB;
		/// <summary>
		///出售的人民币价格
		/// </summary>
        public decimal? ConfirmRMB
		{
            get { return _confirmRMB; }
            set { this.ChangeNotify<decimal?>("ConfirmRMB", value, ref _confirmRMB); }
		}
        private decimal? _salesReturn;
		/// <summary>
		///卖出退点
		/// </summary>
        public decimal? SalesReturn
		{
            get { return _salesReturn; }
            set { this.ChangeNotify<decimal?>("SalesReturn", value, ref _salesReturn); }
		}
		private int _customerid;
		/// <summary>
		///客户ID
		/// </summary>
		public int CustomerID
		{
		get{ return _customerid;}
		set{this.ChangeNotify<int>("CustomerID", value, ref _customerid);}
		}
		private int _userid;
		/// <summary>
		///操作员ID
		/// </summary>
		public int UserID
		{
		get{ return _userid;}
		set{this.ChangeNotify<int>("UserID", value, ref _userid);}
		}
        private int _addressId;
        /// <summary>
        ///地址ID
        /// </summary>
        public int AddressID
        {
            get { return _addressId; }
            set { this.ChangeNotify<int>("AddressID", value, ref _addressId); }
        }
		private string _remarks;
		/// <summary>
		///备注
		/// </summary>
		public string Remarks
		{
		get{ return _remarks;}
		set{this.ChangeNotify<string>("Remarks", value, ref _remarks);}
		}
        private int _paymentBankID;
        /// <summary>
        ///付款银行账户ID
        /// </summary>
        public int PaymentBankID
        {
            get { return _paymentBankID; }
            set { this.ChangeNotify<int>("PaymentBankID", value, ref _paymentBankID); }
        }
        private int _receiptBankID;
        /// <summary>
        ///收款银行账户ID
        /// </summary>
        public int ReceiptBankID
        {
            get { return _receiptBankID; }
            set { this.ChangeNotify<int>("ReceiptBankID", value, ref _receiptBankID); }
        }

        private int _purchaseuserid;
        /// <summary>
        ///采购ID
        /// </summary>
        public int PurchaseUserID
        {
            get { return _purchaseuserid; }
            set { this.ChangeNotify<int>("PurchaseUserID", value, ref _purchaseuserid); }
        } 

		private int _orderstatus;
		/// <summary>
		///订单状态：0 删除 1 待采购 2 待到货 3 待出货 4 已出货 5 取消成功，已作废 6 退货成功 已自留 7 已退回 8 正常（1,2,3,4） 9 异常（5,6,7）
		/// </summary>
		public int OrderStatus
		{
		get{ return _orderstatus;}
		set{this.ChangeNotify<int>("OrderStatus", value, ref _orderstatus);}
		}
		private int _paymentstatus = 0;
		/// <summary>
		///付款状态：0未支付 1已支付
		/// </summary>
		public int PaymentStatus
		{
		get{ return _paymentstatus;}
		set{this.ChangeNotify<int>("PaymentStatus", value, ref _paymentstatus);}
		}
		private DateTime? _paymenttime;
		/// <summary>
		///付款时间
		/// </summary>
		public DateTime? PaymentTime
		{
            get
            {
                if (_paymenttime != null && Convert.ToDateTime(_paymenttime.ToString()).Year > 1970)
                    return _paymenttime;
                else
                    return null;
            }
		set{this.ChangeNotify<DateTime?>("PaymentTime", value, ref _paymenttime);}
		}
		private int _receiptstatus = 0;
		/// <summary>
		///收款状态：0未支付 1已支付
		/// </summary>
		public int ReceiptStatus
		{
		get{ return _receiptstatus;}
		set{this.ChangeNotify<int>("ReceiptStatus", value, ref _receiptstatus);}
		}
		private DateTime? _rectime;
		/// <summary>
		///收款时间
		/// </summary>
		public DateTime? RecTime
		{

            get
            {
                if (_rectime != null && Convert.ToDateTime(_rectime.ToString()).Year > 1970)
                    return _rectime;
                else
                    return null;
            }
		set{this.ChangeNotify<DateTime?>("RecTime", value, ref _rectime);}
		}
		private decimal _freight;
		/// <summary>
		///运费
		/// </summary>
		public decimal Freight
		{
		get{
            if (_freight != null )
                return _freight;
            else
                return 0;
        }
		set{this.ChangeNotify<decimal>("Freight", value, ref _freight);}
		}
		private string _shipno;
		/// <summary>
		///出货单号
		/// </summary>
		public string ShipNo
		{
		get{ return _shipno;}
		set{this.ChangeNotify<string>("ShipNo", value, ref _shipno);}
		}
		private DateTime? _shiptime;
		/// <summary>
		///出货时间
		/// </summary>
		public DateTime? ShipTime 
		{
		get{
            if (_shiptime!=null && Convert.ToDateTime(_shiptime.ToString()).Year > 1970)
                return _shiptime;
            else
                return null;
        }
		set{this.ChangeNotify<DateTime?>("ShipTime", value, ref _shiptime);}
		}
		private string _shipremarks;
		/// <summary>
		///出货备注
		/// </summary>
		public string ShipRemarks
		{
		get{ return _shipremarks;}
		set{this.ChangeNotify<string>("ShipRemarks", value, ref _shipremarks);}
		}
		private int _online;
		/// <summary>
		///回库状态,(NULL没有回库，1回库 )
		/// </summary>
		public int Online
		{
		get{ return _online;}
		set{this.ChangeNotify<int>("Online", value, ref _online);}
		}
        private decimal? _buydis;
        /// <summary>
        ///
        /// </summary>
        public decimal? BuyDis
        {
            get { return _buydis; }
            set { this.ChangeNotify<decimal?>("BuyDis", value, ref _buydis); }
        }
        private decimal? _buyusdprice;
        /// <summary>
        ///
        /// </summary>
        public decimal? BuyUSDPrice
        {
            get { return _buyusdprice; }
            set { this.ChangeNotify<decimal?>("BuyUSDPrice", value, ref _buyusdprice); }
        }
        private decimal? _buyrmbprice;
        /// <summary>
        ///
        /// </summary>
        public decimal? BuyRMBPrice
        {
            get { return _buyrmbprice; }
            set { this.ChangeNotify<decimal?>("BuyRMBPrice", value, ref _buyrmbprice); }
        }
        private string _buypurchasesupplier;
        /// <summary>
        ///
        /// </summary>
        public string BuyPurchaseSupplier
        {
            get { return _buypurchasesupplier; }
            set { this.ChangeNotify<string>("BuyPurchaseSupplier", value, ref _buypurchasesupplier); }
        }
        private DateTime _buypurchasetime;
        /// <summary>
        ///买入时间
        /// </summary>
        public DateTime BuyPurchaseTime
        {
            get { return _buypurchasetime; }
            set { this.ChangeNotify<DateTime>("BuyPurchaseTime", value, ref _buypurchasetime); }
        }

		private DateTime _createtime;
		/// <summary>
		///创建时间
		/// </summary>
		public DateTime CreateTime
		{
		get{ return _createtime;}
		set{this.ChangeNotify<DateTime>("CreateTime", value, ref _createtime);}
		}
		private DateTime _modifytime;
		/// <summary>
		///修改时间
		/// </summary>
		public DateTime modifyTime
		{
		get{ return _modifytime;}
		set{this.ChangeNotify<DateTime>("modifyTime", value, ref _modifytime);}
		}

        private string _activeIP; //下单IP 
        public string ActiveIP
        {
            get { return _activeIP; }
            set { this.ChangeNotify<string>("ActiveIP", value, ref _activeIP); }
        }
        private string _activeAddress;//下单地址
        public string ActiveAddress
        {
            get { return _activeAddress; }
            set { this.ChangeNotify<string>("ActiveAddress", value, ref _activeAddress); }
        }
        #endregion
    }

}
